home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / newsgrp / group94a.txt / 000019_icon-group-sender _Fri Jan 14 04:57:58 1994.msg < prev    next >
Internet Message Format  |  1994-08-19  |  1KB

  1. Received: by cheltenham.cs.arizona.edu; Thu, 20 Jan 1994 09:07:11 MST
  2. Date: 14 Jan 94 04:57:58 GMT
  3. From: bloom-beacon.mit.edu!pad-thai.aktis.com!noc.near.net!news.delphi.com!dligda@uunet.uu.net  (David Ligda)
  4. Organization: Delphi Internet Services Corporation
  5. Subject: Need help outputing to file
  6. Message-Id: <9401132354591.dligda.DLITE@delphi.com>
  7. Sender: icon-group-request@cs.arizona.edu
  8. To: icon-group@cs.arizona.edu
  9. Status: R
  10. Errors-To: icon-group-errors@cs.arizona.edu
  11.  
  12. Hello All,
  13.  
  14. I need some help with a very simple ICON program.
  15.  
  16. I would like to write a program that takes two command line paramaters
  17. (input file and output file), reads each line from the input file and writes
  18. it to the output file.  Here is what I have so far:
  19.  
  20.  
  21. procedure main(args)
  22.        in := open(args[1]) | stop("Can't open input file")
  23.        out := open(args[2], "w") | stop("cannot open output file")
  24.       #
  25.       #  Loop to process lines of file.
  26.       #
  27.         while out := read(in) do {
  28.            write(out)
  29.            }
  30. end
  31.  
  32. This seems to read the input file O.K. but writes the output to the screen
  33. rather than the output file.
  34.  
  35. Any hints on what I am doing wrong?
  36.  
  37. Thanks in advance.
  38.  
  39. David       
  40.